<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //通过object方法自定义对象

        //创建对象
        var Student = new Object
        //为对象添加属性
        Student.age = 19
        Student.name = '高伟杰'
        Student['s-b']=456
        Student[9527]='特朗普'
        console.log(Student[9527]);
        console.log(Student.age);
        console.log(Student['name']);
        console.log(Student['s-b']);
        //为对象添加方法
        Student.run = function () {
            console.log('我正在跑步');
        }
        Student.show = function () {
            console.log('我的名字叫' + this.name + '我的年龄是' + this.age);
        }
        //调用对象的方法【对象名.方法名（）；或对象名【方法名】（）；】
        Student.show();
        Student['run']();


    </script>
</head>

<body>

</body>

</html>